package com.quandou.base.security.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.quandou.base.security.entity.QdAuthority;
import com.quandou.base.security.mapper.QdAuthorityMapper;
import com.quandou.base.security.service.QdAuthorityService;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class QdAuthorityServiceImpl extends ServiceImpl<QdAuthorityMapper, QdAuthority> implements QdAuthorityService {
    private QdAuthorityMapper qdAuthorityMapper;

    public QdAuthorityServiceImpl(QdAuthorityMapper qdAuthorityMapper) {
        this.qdAuthorityMapper = qdAuthorityMapper;
    }

    @Override
    public List<QdAuthority> findAuthorityByUserId(Integer userId) {
        return null;
    }

    @Override
    public QdAuthority findByUrlAndMethod(String url, String method) {
        return qdAuthorityMapper.selectOne(new LambdaQueryWrapper<QdAuthority>().eq(QdAuthority::getUrl, url).and(w -> w.eq(QdAuthority::getMethod, method)));
    }
}
